home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / prg_basi / regsrc.zip / REGISTRY.CLS < prev   
Text File  |  1996-10-01  |  1KB  |  52 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "Registry"
  6. Attribute VB_Creatable = True
  7. Attribute VB_Exposed = True
  8.    
  9.  
  10.  
  11. Public Sub ReadData(dRoot As String, KeyName As String, KeyValue As String)
  12.      Dim KeyHandle As Long
  13.    Dim KeyValueLength As Long
  14.    Dim Ret As Long
  15.    '
  16.    ' initialize string with enough space to receive data
  17.    ' otherwise, GPF will occur
  18.    '
  19.    Value = Space(512)
  20.    '
  21.    ' get previous size and position information from the INI file
  22.    '
  23.    KeyValue = Space(512)
  24.    KeyValueLength = Len(KeyValue)
  25.  
  26.    Ret = RegOpenKey(dRoot, KeyName, KeyHandle)
  27.    If Ret <> 0 Then
  28.       Exit Sub
  29.    End If
  30.    
  31.    Ret = RegQueryValue(KeyHandle, KeyName, KeyValue, KeyValueLength)
  32.    If Ret <> 0 Then
  33.       Ret = RegCloseKey(KeyHandle)
  34.       Exit Sub
  35.    End If
  36. End Sub
  37. Public Sub SaveData(dRoot As String, KeyName As String, KeyValue As String)
  38.       Dim KeyHandle As Long
  39.    Dim Ret As Long
  40.   
  41.    KeyName = "WGP\" & AppName & "\Form Position"
  42.    KeyValue = CurForm.Left & " " & CurForm.Top & " " & CurForm.Width & " " & CurForm.Height
  43.  
  44.    Ret = RegCreateKey(dRoot, KeyName, KeyHandle)
  45.    If Ret <> 0 Then
  46.       Exit Sub
  47.    End If
  48.  
  49.    Ret = RegSetValue(KeyHandle, KeyName, REG_SZ, KeyValue, Len(KeyValue))
  50.    Ret = RegCloseKey(KeyHandle)
  51. End Sub
  52.